package HashMap的7种遍历方式;

import java.util.HashMap;
import java.util.Map;

public class Four {
    //ForEach KeySet方式
    public static void main(String[] args) {
        Map<Integer, String> map = new HashMap<>();
        map.put(1,"Java");
        map.put(2,"C++");
        map.put(3,"C");
        map.put(4,"Python");
        map.put(5,"Golang");

        //遍历
        for (Integer key : map.keySet()){
            System.out.println(key);
            System.out.println(map.get(key));
        }
    }
}
